﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Things.Common;

namespace Things.Web.Components
{
    public partial class GoodsInformationForOrderPlan : System.Web.UI.UserControl
    {
        public Guid GoodsID
        {
            get
            {
                Guid temp = Guid.Empty;
                try
                {
                    if (Request.QueryString["goodsID"] != null)
                    {
                        bool flag = Guid.TryParse(Request.QueryString["goodsID"].Trim(), out temp);
                        if (flag == false)
                        {
                            temp = Guid.Empty;
                        }
                    }
                }
                catch
                {
                    temp = Guid.Empty;
                }
                return temp;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData(GoodsID);
            }
        }


        protected void BindData(Guid GoodsID)
        {


            Things.BLL.Goods gBLL = new BLL.Goods();
            Things.Model.Goods gModel = gBLL.GetModel(GoodsID);
            if (gModel != null)
            {
                Session[ConstantString.SessionImages] = gModel.GoodsImage;
                this.imgGoodsImage.ImageUrl = "../DisplayImage.aspx";
                this.lblGoodsTitle.Text = gModel.GoodsName;
                this.lblWeight.Text = gModel.GoodsWeight.ToString();
            }
        }

    }
}